EventDispatcher = function(){}

EventDispatcher.prototype = {
	
	listeners : new Collection(),
	
	addListener : function ( listener )
	{
		this.listeners.add ( listener );
	},
	
	removeListener : function ( listener )
	{
		this.listeners.remove ( listener );
	},
	
	hasListener : function () 
	{
		return this.listeners.size() != 0;
	},
	
	fireEvent : function( event )
	{
		var iterator = this.listeners.iterator();
		
		while ( iterator.hasNext() )
		{
			var listener = iterator.next();

			listener[ event.type ]( event );
		}
	}	
}

Event = function ( type, source )
{
	this.type = type;
	this.source = source;
}
